<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for components\form-item\dx-form-item.vue</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../prettify.css" />
    <link rel="stylesheet" href="../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(../../sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="../../index.html">all files</a> / <a href="index.html">components/form-item/</a> dx-form-item.vue
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">1.64% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>1/61</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/51</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>0/2</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">1.69% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>1/59</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1×</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&lt;template&gt;
	&lt;div 
		class="dx-form-item" 
		:style="{ width: width + 'px'}"
	&gt;
		&lt;slot&gt;&lt;/slot&gt;
		&lt;ul v-if="showPwdLevel" class="dx-form-item__password-level-wrap"&gt;
			&lt;li
				v-for="(level, index) of pwdLevels" 
				:key="level"
				:class="[inputPwdLevel &gt; index ? 'dx-form-item__password-level--number-' + index : '']"
				class="dx-form-item__password-level"
			&gt;
				{{ level }}
			&lt;/li&gt;
		&lt;/ul&gt;
		&lt;div 
			v-if="showMsg &amp;&amp; text" 
			:class="[textClasses, {'is-bottom': bottom}]"
		&gt;
			{{ text }}
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/template&gt;
&lt;script&gt;
   import Validate from '@/utils/stragetegies.js'
   // 用于与组件dx-form-item通信
   import Bus from '@/utils/bus.js'
   const noop = () =&gt; <span class="fstat-no" title="function not covered" >{}</span>
&nbsp;
	export default{
		componentName: 'DxFormItem',
		name: 'DxFormItem',
		props: {
			// 是否启用输入框blur/onfoucs事件时触发验证
			isValidate: {
				type: Boolean,
				default: false
			},
			prop: String,
			samePorp: String,
			showMsg: Boolean,
			showPwdLevel: Boolean,
			rules: Array,
			instruction: String,
			width: String,
			isEffect: { // 是否应用开启验证，默认是开启，应用于根据条件是否开启验证
				type: Boolean,
				default: true
			},
			bottom: Boolean // 设置验证错误是信息在输入框下方显示
		},
		data() {
<span class="cstat-no" title="statement not covered" >			return {</span>
				text: '',
				textClass: '',
				pwdLevels: ['弱', '中', '强'],
				inputPwdLevel: 0
			}
		},
		computed: {
			textClasses() {
<span class="cstat-no" title="statement not covered" >				return `dx-form-item--text ${this.textClass} ${this.msgTextClass}`</span>
			},
			// 找到父元素dx-form组件
			form() {
				let parent = <span class="cstat-no" title="statement not covered" >this.$parent</span>
				let	parentName = <span class="cstat-no" title="statement not covered" >parent.$options.componentName</span>
<span class="cstat-no" title="statement not covered" >				while (parentName !== 'DxForm') {</span>
<span class="cstat-no" title="statement not covered" >					parent = parent.$parent</span>
<span class="cstat-no" title="statement not covered" >					parentName = parent.$option.componentName</span>
				}
<span class="cstat-no" title="statement not covered" >				return parent</span>
			},
			msgTextClass() {
<span class="cstat-no" title="statement not covered" >				return this.form.msgTextClass</span>
			},
			// 得到该该表单元素的输入值
			fieldValue: {
				cache: false,
				get() {
					let model = <span class="cstat-no" title="statement not covered" >this.form.model</span>
<span class="cstat-no" title="statement not covered" >					if (!model || !this.prop) { <span class="cstat-no" title="statement not covered" >return </span>}</span>
<span class="cstat-no" title="statement not covered" >					return model[this.prop]</span>
				}
			},
			sameFieldValue: {
				cache: false,
				get() {
					let model = <span class="cstat-no" title="statement not covered" >this.form.model</span>
<span class="cstat-no" title="statement not covered" >					if (!model || !this.samePorp) { <span class="cstat-no" title="statement not covered" >return </span>}</span>
<span class="cstat-no" title="statement not covered" >					return model[this.samePorp]</span>
				}
			}
		},
		mounted() {
<span class="cstat-no" title="statement not covered" >			if (this.prop) {</span>
				/*
				    $on.$emit父子间通信，父组件只能通过绑定到模板中才可以即v-on:xxxx=""。
				    总之on和emit的事件必须是在一个公共的实例上，才能触发。
				    这里为了通信，采用新建一个vue实例通信。
				*/
<span class="cstat-no" title="statement not covered" >				Bus.$emit('dx-form-addField', this)</span>
			}
			let rules = <span class="cstat-no" title="statement not covered" >this.getRules()</span>
<span class="cstat-no" title="statement not covered" >			if (rules.length &gt; 0) {</span>
<span class="cstat-no" title="statement not covered" >				this.$on('dx-form-blur', this.onFieldBlur)</span>
<span class="cstat-no" title="statement not covered" >				this.$on('dx-form-focus', this.onFieldFocus)</span>
			}
		},
		methods: {
			// 验证规则
			validate(trigger = '', callback = noop) {
				// 判断是否开启验证
<span class="cstat-no" title="statement not covered" >				if (!this.isEffect) {</span>
<span class="cstat-no" title="statement not covered" >					return true</span>
				}
				let rules = <span class="cstat-no" title="statement not covered" >this.getFilterRules(trigger)</span>
<span class="cstat-no" title="statement not covered" >				if (!rules || rules.length === 0) {</span>
<span class="cstat-no" title="statement not covered" >					callback()</span>
<span class="cstat-no" title="statement not covered" >					return true</span>
				}
				let errorMsg = <span class="cstat-no" title="statement not covered" >false</span>
				let	rule = <span class="cstat-no" title="statement not covered" >null</span>
				// required优先级最高
<span class="cstat-no" title="statement not covered" >				for (let i = 0, len = rules.length; i &lt; len; i++) {</span>
<span class="cstat-no" title="statement not covered" >					rule = rules[i]</span>
					// rule.value = this.fieldValue;
					// 如果是和其他输入域输入要一致
<span class="cstat-no" title="statement not covered" >					if (rule.name === 'confirmSame') {</span>
<span class="cstat-no" title="statement not covered" >						rule.sameFieldValue = this.sameFieldValue</span>
					}
					let rst = <span class="cstat-no" title="statement not covered" >Validate[rule.name](rule, this.fieldValue)</span>
					// 处理密码强度验证逻辑
<span class="cstat-no" title="statement not covered" >					if (rule.name === 'pwdLevelVerification') {</span>
<span class="cstat-no" title="statement not covered" >						this.inputPwdLevel = rst</span>
					}
<span class="cstat-no" title="statement not covered" >					if (!rst) {</span>
<span class="cstat-no" title="statement not covered" >						this.text = rule.message || ''</span>
<span class="cstat-no" title="statement not covered" >						this.textClass = 'is-error'</span>
<span class="cstat-no" title="statement not covered" >						errorMsg = true</span>
						/* 当确定输入为空的时候，立即返回 */
<span class="cstat-no" title="statement not covered" >						if (rule.name === 'required') {</span>
<span class="cstat-no" title="statement not covered" >							break</span>
						}
					}
				}
				// 如果验证正确，清除错误信息
<span class="cstat-no" title="statement not covered" >				if (!errorMsg) {</span>
<span class="cstat-no" title="statement not covered" >					this.text = ''</span>
				}
<span class="cstat-no" title="statement not covered" >				callback(errorMsg)</span>
			},
			// 得到该field的所有验证要求---后续优化，需要写一个合并函数，合并对象相同属性的值
			getRules() {
				let formRules = <span class="cstat-no" title="statement not covered" >this.form.rules</span>
				let	selfRules = <span class="cstat-no" title="statement not covered" >this.rules</span>
				let	baseRules = <span class="cstat-no" title="statement not covered" >formRules &amp;&amp; formRules.baseRule ? formRules.baseRule : []</span>
<span class="cstat-no" title="statement not covered" >				formRules = formRules &amp;&amp; formRules[this.prop] ? formRules[this.prop].concat(baseRules) : baseRules</span>
				// 可以在form表单上设置了公共校验规则
<span class="cstat-no" title="statement not covered" >				return [].concat(selfRules || formRules || [])</span>
			},
			// 根据触发添加得到验证规则
			getFilterRules(trigger) {
				let allRules = <span class="cstat-no" title="statement not covered" >this.getRules()</span>
<span class="cstat-no" title="statement not covered" >				return allRules.filter((rule) =&gt; <span class="fstat-no" title="function not covered" >{</span></span>
<span class="cstat-no" title="statement not covered" >					return !rule.trigger || rule.trigger.indexOf(trigger) !== -1</span>
				})
			},
			// 注销组件的时候，自动移除组件函数
			beforeDestory() {
<span class="cstat-no" title="statement not covered" >				Bus.$emit('dx.form.removeField', this)</span>
			},
			onFieldBlur() {
<span class="cstat-no" title="statement not covered" >				this.isValidate &amp;&amp; this.validate('blur')</span>
			},
			onFieldFocus() {
<span class="cstat-no" title="statement not covered" >				if (this.isValidate) {</span>
<span class="cstat-no" title="statement not covered" >					this.text = this.instruction || ''</span>
<span class="cstat-no" title="statement not covered" >					this.textClass = 'dx-form-item--instruction'</span>
				}
			}
		}
	}
&lt;/script&gt;
&lt;style lang="scss"&gt;
	@include B(form-item) {
		position: relative;
		// 密码等级
		@include E(password-level-wrap) {
			display: flex;
			width: 80%;
		}
		// 密码等级
		@include E(password-level) {
			flex-grow: 1;
			line-height: 3rem;
			font-size: 1.4rem;
			margin-top: 1rem;
			border: 1px solid #555;
			border-left: none;
			text-align: center;
			background-color: #ddd;
			opacity: 0.8;
			&amp;:first-child {
				border-left: 1px solid #555;
				border-radius: 1.5rem 0 0 1.5rem;
			}
			&amp;:last-child {
				border-radius: 0 1.5rem 1.5rem 0;
			}
&nbsp;
			@include M(number-0) {
				background-color: red;
			}
			@include M(number-1) {
				background-color: yellow;
			}
			@include M(number-2) {
				background-color: green;
			}
		}
		@include M(text) {
			position: absolute;
			width: 100%;
			top: 0;
			word-wrap: normal;
			left: 82%;
			height: $--dx-form-item-text-height;
			line-height: $--dx-form-item-text-line-height;
			@include when(bottom) {
				position: static;
			}
&nbsp;
			@include when(error) {
				color: $--dx-form-item-text-color-error;
			}
		}
		@include M(instruction) {
			color: $--dx-form-item-instruction-color;
		}
	}
&lt;/style&gt;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 15:08:50 GMT+0800 (中国标准时间)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>
